<HTML><HEAD>
<TITLE>netwib doc_html (version 5.39.0)</TITLE>
</HEAD><BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H2><A HREF="../../index.html">main index</A></H2>
<H2><A HREF="../pkt.html">section index</A></H2><HR><BR>
<PRE>

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000"><B>/***************************************************************
 * Refer to RFC 792 to obtain more information about ICMPv4.   *
 ***************************************************************/</B></FONT>

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* ICMP4 types. Comments starting with "NI" are not implemented */</FONT>
typedef enum {
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_ECHOREP</FONT> = 0,       <FONT COLOR="#880000">/* echo reply */</FONT>
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_DSTUNREACH</FONT> = 3,    <FONT COLOR="#880000">/* destination unreachable */</FONT>
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_SRCQUENCH</FONT> = 4,     <FONT COLOR="#880000">/* source quench */</FONT>
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_REDIRECT</FONT> = 5,      <FONT COLOR="#880000">/* redirect */</FONT>
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_ALTHOSTAD</FONT> = 6,     <FONT COLOR="#880000">/* NI www.iana.org */</FONT>
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_ECHOREQ</FONT> = 8,       <FONT COLOR="#880000">/* echo request */</FONT>
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_ROUTERADVERT</FONT> = 9,  <FONT COLOR="#880000">/* NI rfc 1256 */</FONT>
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_ROUTERSELECT</FONT> = 10, <FONT COLOR="#880000">/* NI rfc 1256 */</FONT>
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_TIMEEXCEED</FONT> = 11,   <FONT COLOR="#880000">/* time exceeded */</FONT>
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_PARAPROB</FONT> = 12,     <FONT COLOR="#880000">/* parameter problem */</FONT>
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_TIMESTAMPREQ</FONT> = 13, <FONT COLOR="#880000">/* timestamp request */</FONT>
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_TIMESTAMPREP</FONT> = 14, <FONT COLOR="#880000">/* timestamp reply */</FONT>
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_INFOREQ</FONT> = 15,      <FONT COLOR="#880000">/* information request */</FONT>
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_INFOREP</FONT> = 16,      <FONT COLOR="#880000">/* information reply */</FONT>
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_ADMASKREQ</FONT> = 17,    <FONT COLOR="#880000">/* NI rfc 950 */</FONT>
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_ADMASKREP</FONT> = 18,    <FONT COLOR="#880000">/* NI rfc 950 */</FONT>
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_TRACEROUTE</FONT> = 30,   <FONT COLOR="#880000">/* NI rfc 1393 */</FONT>
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_DATACONVERR</FONT> = 31,  <FONT COLOR="#880000">/* NI rfc 1474 */</FONT>
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_MOBHOSTREDIR</FONT> = 32, <FONT COLOR="#880000">/* NI www.iana.org */</FONT>
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_IPV6WHEREYOU</FONT> = 33, <FONT COLOR="#880000">/* NI www.iana.org */</FONT>
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_IPV6IAMHERE</FONT> = 34,  <FONT COLOR="#880000">/* NI www.iana.org */</FONT>
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_MOBREGREQ</FONT> = 35,    <FONT COLOR="#880000">/* NI www.iana.org */</FONT>
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_MOBREGREP</FONT> = 36,    <FONT COLOR="#880000">/* NI www.iana.org */</FONT>
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_SKIP</FONT> = 39,         <FONT COLOR="#880000">/* NI www.iana.org */</FONT>
  <FONT COLOR="#000044">NETWIB_ICMP4TYPE_PHOTURIS</FONT> = 40      <FONT COLOR="#880000">/* NI www.iana.org */</FONT>
} <FONT COLOR="#000088">netwib_icmp4type</FONT>;

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
typedef enum {
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_ECHOREP</FONT> = 0,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_DSTUNREACH_NET</FONT> = 0,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_DSTUNREACH_HOST</FONT> = 1,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_DSTUNREACH_PROTO</FONT> = 2,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_DSTUNREACH_PORT</FONT> = 3,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_DSTUNREACH_FRAG</FONT> = 4,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_DSTUNREACH_SR</FONT> = 5,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_DSTUNREACH_NETUNKNOWN</FONT> = 6,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_DSTUNREACH_HOSTUNKNOWN</FONT> = 7,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_DSTUNREACH_HOSTISOL</FONT> = 8,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_DSTUNREACH_NETPROHI</FONT> = 9,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_DSTUNREACH_HOSTPROHI</FONT> = 10,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_DSTUNREACH_NETTOS</FONT> = 11,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_DSTUNREACH_HOSTTOS</FONT> = 12,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_DSTUNREACH_PROHI</FONT> = 13,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_DSTUNREACH_PRECVIOL</FONT> = 14,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_DSTUNREACH_PRECCUTOFF</FONT> = 15,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_SRCQUENCH</FONT> = 0,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_REDIRECT_NET</FONT> = 0,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_REDIRECT_HOST</FONT> = 1,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_REDIRECT_NETTOS</FONT> = 2,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_REDIRECT_HOSTTOS</FONT> = 3,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_ECHOREQ</FONT> = 0,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_TIMEEXCEED_TTL</FONT> = 0,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_TIMEEXCEED_FRAG</FONT> = 1,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_PARAPROB_POINTER</FONT> = 0,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_PARAPROB_MISSOPT</FONT> = 1,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_PARAPROB_BADLEN</FONT> = 2,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_TIMESTAMPREQ</FONT> = 0,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_TIMESTAMPREP</FONT> = 0,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_INFOREQ</FONT> = 0,
  <FONT COLOR="#000044">NETWIB_ICMP4CODE_INFOREP</FONT> = 0
} <FONT COLOR="#000088">netwib_icmp4code</FONT>;

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_buf_append_icmp4type
   Description :
     Print the text corresponding to icmp type.
   Input parameter(s) :
     type : icmp4 type
   Input/output parameter(s) :
     *pbuf : <FONT COLOR="#000088">netwib_buf</FONT> receiving data
   Output parameter(s) :
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_buf_append_icmp4type</B>(<FONT COLOR="#000088">netwib_icmp4type</FONT> type,
                                       <FONT COLOR="#000088">netwib_buf</FONT> *pbuf);

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_buf_append_icmp4code
   Description :
     Print the text corresponding to icmp code.
   Input parameter(s) :
     type : icmp4 type
     code : icmp4 code
   Input/output parameter(s) :
     *pbuf : <FONT COLOR="#000088">netwib_buf</FONT> receiving data
   Output parameter(s) :
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_buf_append_icmp4code</B>(<FONT COLOR="#000088">netwib_icmp4type</FONT> type,
                                       <FONT COLOR="#000088">netwib_icmp4code</FONT> code,
                                       <FONT COLOR="#000088">netwib_buf</FONT> *pbuf);

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
typedef struct {
  <FONT COLOR="#000088">netwib_uint16</FONT> id;
  <FONT COLOR="#000088">netwib_uint16</FONT> seqnum;
  <FONT COLOR="#000088">netwib_bufext</FONT> data;
} <FONT COLOR="#000088">netwib_icmp4_echo</FONT>;

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
typedef struct {
  <FONT COLOR="#000088">netwib_uint32</FONT> reserved;
  <FONT COLOR="#000088">netwib_bufext</FONT> badippacket;
} <FONT COLOR="#000088">netwib_icmp4_dstunreach</FONT>;

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
typedef struct {
  <FONT COLOR="#000088">netwib_uint32</FONT> reserved;
  <FONT COLOR="#000088">netwib_bufext</FONT> badippacket;
} <FONT COLOR="#000088">netwib_icmp4_srcquench</FONT>;

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
typedef struct {
  <FONT COLOR="#000088">netwib_ip</FONT> gw;
  <FONT COLOR="#000088">netwib_bufext</FONT> badippacket;
} <FONT COLOR="#000088">netwib_icmp4_redirect</FONT>;

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
typedef struct {
  <FONT COLOR="#000088">netwib_uint32</FONT> reserved;
  <FONT COLOR="#000088">netwib_bufext</FONT> badippacket;
} <FONT COLOR="#000088">netwib_icmp4_timeexceed</FONT>;

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
typedef struct {
  <FONT COLOR="#000088">netwib_uint8</FONT> pointer;
  <FONT COLOR="#000088">netwib_uint32</FONT> reserved;
  <FONT COLOR="#000088">netwib_bufext</FONT> badippacket;
} <FONT COLOR="#000088">netwib_icmp4_paraprob</FONT>;

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
typedef struct {
  <FONT COLOR="#000088">netwib_uint16</FONT> id;
  <FONT COLOR="#000088">netwib_uint16</FONT> seqnum;
  <FONT COLOR="#000088">netwib_uint32</FONT> originatetimestamp;
  <FONT COLOR="#000088">netwib_uint32</FONT> receivetimestamp;
  <FONT COLOR="#000088">netwib_uint32</FONT> transmittimestamp;
} <FONT COLOR="#000088">netwib_icmp4_timestamp</FONT>;

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
typedef struct {
  <FONT COLOR="#000088">netwib_uint16</FONT> id;
  <FONT COLOR="#000088">netwib_uint16</FONT> seqnum;
  <FONT COLOR="#000088">netwib_bufext</FONT> data;
} <FONT COLOR="#000088">netwib_icmp4_info</FONT>;

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
typedef struct {
  <FONT COLOR="#000088">netwib_icmp4type</FONT> type;
  <FONT COLOR="#000088">netwib_icmp4code</FONT> code;
  <FONT COLOR="#000088">netwib_uint16</FONT> check;
  union {
    <FONT COLOR="#000088">netwib_icmp4_echo</FONT> echo; <FONT COLOR="#880000">/* used for request and reply */</FONT>
    <FONT COLOR="#000088">netwib_icmp4_dstunreach</FONT> dstunreach;
    <FONT COLOR="#000088">netwib_icmp4_srcquench</FONT> srcquench;
    <FONT COLOR="#000088">netwib_icmp4_redirect</FONT> redirect;
    <FONT COLOR="#000088">netwib_icmp4_timeexceed</FONT> timeexceed;
    <FONT COLOR="#000088">netwib_icmp4_paraprob</FONT> paraprob;
    <FONT COLOR="#000088">netwib_icmp4_timestamp</FONT> timestamp; <FONT COLOR="#880000">/* used for req and rep */</FONT>
    <FONT COLOR="#000088">netwib_icmp4_info</FONT> info; <FONT COLOR="#880000">/* used for request and reply */</FONT>
  } msg;
} <FONT COLOR="#000088">netwib_icmp4</FONT>;
typedef const <FONT COLOR="#000088">netwib_icmp4</FONT> <FONT COLOR="#000088">netwib_consticmp4</FONT>;
<FONT COLOR="#008800">#define <FONT COLOR="#000044">NETWIB_ICMP4_MINLEN</FONT> 4</FONT>

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_icmp4_initdefault
   Description :
     Initialize a <FONT COLOR="#000088">netwib_icmp4</FONT> with default values.
   Input parameter(s) :
   Input/output parameter(s) :
   Output parameter(s) :
     *picmp4hdr : <FONT COLOR="#000088">netwib_icmp4hdr</FONT> to initialize
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_icmp4_initdefault</B>(<FONT COLOR="#000088">netwib_icmp4type</FONT> type,
                                    <FONT COLOR="#000088">netwib_icmp4</FONT> *picmp4);

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_pkt_append_icmp4
   Description :
     Initialize physical data from a netwib_icmp4.
   Input parameter(s) :
     icmp4 : netwib_icmp4
   Input/output parameter(s) :
     *ppht : buffer to initialize
   Output parameter(s) :
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_pkt_append_icmp4</B>(<FONT COLOR="#000088">netwib_consticmp4</FONT> *picmp4,
                                   <FONT COLOR="#000088">netwib_buf</FONT> *ppkt);

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_pkt_decode_icmp4
   Description :
     Decode a <FONT COLOR="#000088">netwib_icmp4</FONT> from data coming from wire.
   Input parameter(s) :
     pktproto : protocol of the <FONT COLOR="#000088">netwib_icmp4</FONT> in ppkt
     *ppkt : buffer containing physical data
   Input/output parameter(s) :
   Output parameter(s) :
     *picmp4 : <FONT COLOR="#000088">netwib_icmp4</FONT> to initialize
     *pskipsize : size to skip this header
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_pkt_decode_icmp4</B>(<FONT COLOR="#000088">netwib_constbuf</FONT> *ppkt,
                                   <FONT COLOR="#000088">netwib_icmp4</FONT> *picmp4,
                                   <FONT COLOR="#000088">netwib_uint32</FONT> *pskipsize);
</PRE><BR><BR><HR><BR>
<H2><A HREF="../../index.html">main index</A></H2>
<H2><A HREF="../pkt.html">section index</A></H2>
</BODY></HTML>
